﻿#ifndef QRCODE_H
#define QRCODE_H

#include "param.h"
#include "point.h"
#include "sensororder.h"
#include "serialportobj.h"
#include "utility.h"
#include <QDebug>
#include <QObject>
class Qrcode : public QObject {
    Q_OBJECT
public:
    explicit Qrcode( QObject* parent = nullptr );
    Point returnQrcodePose();
    int   returnQrcodeTagID();
    bool  isReadCode() const;

private:
    SerialPortObj*   qrcode_com = nullptr;        //二维码串口
    Point            qrcode_point;                //二维码接收数据的坐标
    static const int kQrcodeRxLen       = 21;     //二维码接收数据字节长度
    int              last_qrcode_tag_id = 0;      //上一次的二维码标签值
    int              qrcode_tag_id      = 0;      //现在的二维码标签id
    int              lose_connect_time  = 0;      //失去连接时间
    bool             is_read_code       = false;  //是否读取到二维码

signals:
    void sigQrcodRecvieNaviParam();
    void sigSendTips( const QString& );
    void sigSendData( SerialPortObj* obj, const QByteArray& data );
    void sigLoseConnect( const QString& );
    void sigQrcodeReceiveData( QByteArray data, QString str );  //测试,界面显示io接收源数据

public slots:
    void sltQrcodeInit();
    void slt50msTimer();
    void sltPFQrcodeRecvieData( const QByteArray& data );
    void sltDAHUAQrcodeRecvieData( const QByteArray& data );
};

#endif  // QRCODE_H
